#include<iostream>
using namespace std;
int exam4_15_2()
{
	int a, b, tmp;
	cin >> a >> b;
	while (tmp = a % b)
	{
		a = b;
		b = tmp;
	}
	cout << b << endl;
	return 0;
}